<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;

class CourseComment extends Model
{
    //
    public function user(){
        return $this->belongsTo('App\User','user_id');
    }
    public function replay_user(){
        return $this->belongsTo('App\User','replay_user_id');
    }
    public function getCreatedAtAttribute($date)
    {
        if (Carbon::now() < Carbon::parse($date)->addDays(10)) {
            return Carbon::parse($date);
        }

        return Carbon::parse($date)->diffForHumans();
    }
}
